package com.rst.dao;

import org.apache.log4j.Logger;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.rst.model.UserDetailsDTO;

public class AuthenticationDAO extends HibernateDaoSupport {
	
	private Logger logger = Logger.getLogger(AuthenticationDAO.class);
	
	public UserDetailsDTO getDetailsForUserId(String strUserId) throws Exception {
		logger.debug("in method getDetailsForUserId for user with userID as: " + strUserId);
		UserDetailsDTO userDetailsDTO = new UserDetailsDTO();
		getHibernateTemplate().load(userDetailsDTO, strUserId);
		return userDetailsDTO;
	}
	
	public void updateUserDetails(UserDetailsDTO userDetailsDTO) throws Exception{
		logger.debug("in method updateUserDetails: " + userDetailsDTO);
		getHibernateTemplate().saveOrUpdate(userDetailsDTO);
	}
}
